/**
 *
 */
package model;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import util.ApplicationProperties;

/**
 * Represents a series.
 * 
 * @author Marco
 */
public class Series implements IFile {
    private String         name;
    private File           seriesFolder;
    private List<Language> availableLanguages;

    /**
     * Creates a new instance of this class based on the series name and the
     * standard file directory.
     * 
     * @param aName
     */
    public Series(File aRoot, String aName) {
        File tempRootFolderForSeries = ApplicationProperties.getSeriesRoot();
        name = aName;
        seriesFolder = new File(tempRootFolderForSeries, name);
        availableLanguages = new ArrayList<Language>(3);
        for (String tempLanguageFolder : seriesFolder.list()) {
            availableLanguages.add(new Language(seriesFolder,
                    tempLanguageFolder));
        }
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the availableLanguages
     */
    public List<Language> getAvailableLanguages() {
        return availableLanguages;
    }

    /*
     * (non-Javadoc)
     * 
     * @see IFile#getFile()
     */
    @Override
    public File getFile() {
        return seriesFolder;
    }
}
